:root {
  --background: #1e1e1e;
  --button-color: #fffffe;
  --button-hover-color: #fffffe;
  --button-hover-border: #176baa;
  --button-hover-background: #176baa;
}

@media (prefers-color-scheme: light) {
  :root {
    --background: #fffffe;
    --button-color: #176baa;
    --button-hover-color: #fffffe;
    --button-hover-border: #176baa;
    --button-hover-background: #176baa;
  }
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background-color: var(--background);
  font: 16px sans-serif;
}

header {
  padding: 5px;
}

h1 {
  font-size: 0.5em;
  display: flex;
  justify-content: center;
}

h1 img {
  height: 100px;
}

button,
label {
  cursor: pointer;
  font-size: 1em;
  color: var(--button-color);
  background-color: transparent;
  padding: 10px;
  border: solid var(--button-color) 2px;
  border-radius: 5px;
}

button:hover {
  color: var(--button-hover-color);
  background-color: var(--button-hover-background);
  padding: 10px;
  border: solid var(--button-hover-border) 2px;
  border-radius: 5px;
}

button:focus-visible {
  border-color: black;
  outline: white solid 4px;
}

@keyframes rotation {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.loading {
  display: none;
  color: white;
  position: absolute;
}

.loading img {
  animation: 4s linear 0s infinite rotation;
}

.sr-only {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

#container {
  flex: 1 1 auto;
  max-width: 800px;
  width: 100%;
  resize: vertical;
  overflow: auto;
  min-height: 400px;
}

#preview {
  min-width: 400px;
  width: 100%;
  display: flex;
  flex-direction: column;
}

#preview > #canvas-container {
  position: relative;
  min-height: 400px;
  background-color: var(--background);
  display: flex;
  justify-content: center;
  align-items: center;
}

.toolbar {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex-wrap: wrap;
}

.controls {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}

.templates {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 8px;
}

.templates h2 {
  color: var(--button-color);
  font-size: 1.2rem;
  line-height: 1.1;
  margin: 0;
}

.templates a {
  text-decoration: none;
  color: var(--button-color);
  display: flex;
  gap: 12px;
  border: solid var(--button-color) 2px;
  padding: 8px;
  border-radius: 5px;
  min-width: 260px;
}

.icon {
  transition: transform 250ms ease-out;
}

.templates a:hover {
  color: var(--button-hover-color);
  background-color: var(--button-hover-background);
  border: solid var(--button-hover-border) 2px;
}

.templates a:hover .icon {
  transform: scale(1.5) rotate(10deg);
}

main {
  height: 100%;
  display: flex;
}

body.embedded main {
  flex-direction: column-reverse;
  align-items: center;
}

body.embedded .templates {
  display: none;
}

body.embedded header {
  display: none;
}

body.embedded #preview {
  display: flex;
  flex-direction: column;
  max-width: 800px;
  width: 100%;
}

@media screen and (max-width: 800px) {
  h1 img {
    height: 50px;
  }

  main {
    height: auto;
    flex-wrap: wrap-reverse;
  }

  #preview {
    min-width: auto;
  }
}
